import React, { Fragment } from 'react';
// eslint-disable-next-line import/no-duplicates
import { Button } from 'antd';
// eslint-disable-next-line import/no-duplicates
import { Col, Row } from 'antd';
import "./demo.css"
import {history} from 'umi';
import img1 from './loginImg.81783432.png'
import RightCol from './rightCol';


class Demo1 extends React.PureComponent {
  // eslint-disable-next-line no-useless-constructor
  onFinish = (values) => {
    console.log(values);
    const url =`login?username=${values.username}&password=${values.password}`
    fetch(url,
      {
        method:'POST'
      })
      .then(response => response.json())
      .then((data)=>{
        console.log(data);
        const  { token }=data.data;
        localStorage.setItem('Authorization',`Bearer ${token}`)
        // eslint-disable-next-line no-restricted-globals
        history.push('/Demo2')
      });

  };

  render() {
    return (
      <Fragment>
        <div>第一个页面</div>
        <Row>
          <Col span={12} className="col6">
            {/* eslint-disable-next-line jsx-a11y/alt-text */}
            <img src={img1} className="imgStyle" />
          </Col>
          <Col span={12} className="col6">
            <RightCol />
          </Col>
        </Row>
        <Button type="primary">Primary Button</Button>
        <Button>Default Button</Button>
        <Button type="dashed">Dashed Button</Button>
        <br />
        <Button type="text">Text Button</Button>
        <Button type="link">Link Button</Button>
      </Fragment>
    );
  }
}

export default Demo1;
